package com.tuozixuan.transaction.user.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserService2 {
    
    @Autowired
    private JdbcTemplate jdbcTemplate;
    
    @Transactional(propagation = Propagation.REQUIRED)
    public void updateMoney() {
        jdbcTemplate.update("update user set money = money - ? where id = ?", 1000, 2);
    }
}
